#include "Thread.hpp"
#include <vector>
#include <unistd.h>

using namespace std;

const int threadsnum = 5; // 创建的线程数

void Print()
{
    while (true)
    {
        cout << "I am a thread..." << endl;

        sleep(1);
    }

}

int main()
{
    std::vector<Thread> threads;

    for (int i = 0; i < threadsnum; i++)
    {
        threads.push_back(Thread(Print));
        //threads[i].run();
    }

    for (int i = 0; i < threadsnum; i++)
    {
        threads[i].run();
    }

    for (int i = 0; i < threadsnum; i++)
    {
        threads[i].join();
    }

    return 0;
}